import { OmitType } from "@nestjs/swagger";
import { IsNumber, IsOptional, IsString } from "class-validator";
import { Dept } from "../entities/dept.entity";
import { Type } from "class-transformer";

export class ReqDeptListDto {
  // 部门名称
  @IsOptional()
  @IsString()
  dept_name?: string;

  // 状态
  @IsOptional()
  @IsString()
  status?: string;
}

export class ReqAddDeptDto extends OmitType(Dept, ["dept_id"] as const) {
  /* 父部门Id */
  @Type()
  @IsNumber()
  parentId: number;
}

export class ReqUpdateDeptDto extends Dept {
  /* 父部门Id */
  @Type()
  @IsNumber()
  parentId: number;
}
